import { fetchMerchants, fetchStores, } from '@/services/distribution/whole';
const GoodsModel = {
  namespace: 'goods',
  state: {
    selectPics: [],
    isShow: false, // 图片选择modal
    goodsSPEC: [],
  },
  effects: {
    // 商户
    *fetchMerchants(_, { call, put, select }) {
      const data = yield call(fetchMerchants);
      yield put({
        type: 'saveData',
        payload: {
          merchants: data.data
        },
      });
    },
    // 门店
    *fetchStores({payload}, { call, put, select }) {
      const data = yield call(fetchStores, payload);
      yield put({
        type: 'saveData',
        payload: {
          stores: data.data
        },
      });
    },
  },
  reducers: {
    saveData(state, { payload }) {
      return {
        ...state,
        ...payload
      }
    },
  },
};
export default GoodsModel;
